package top.ffhome.concurrent.beautiful.ch01;

import cn.hutool.log.Log;
import cn.hutool.log.LogFactory;

public class SleepInterruptTest2 {
    private static final Log log = LogFactory.get();

    public static void main(String[] args) throws InterruptedException {
        Thread threadOne = new Thread(() -> {
            for (; ; ) {
            }
        });

        threadOne.start();
        threadOne.interrupt();
        // 获取中断标志
        log.info("isInterrupted:{}", threadOne.isInterrupted());
        // 获取中断标志并重置
        log.info("interrupted:{}", threadOne.interrupted());
        log.info("interrupted:{}", threadOne.interrupted());
        log.info("isInterrupted:{}", threadOne.isInterrupted());
        threadOne.join();
        log.info("main thread is over");
    }
}
